package com.jwsoft.manager.core.gateway.controller;

import com.jwsoft.manager.common.vo.eduClassSetting.EduClassSettingYearQueryVO;
import com.jwsoft.manager.core.integration.EduClassSettingIntegration;
import com.jwsoft.manager.common.vo.eduClassSetting.EduClassSettingVO;
import com.jwsoft.manager.common.vo.eduClassSetting.EduClassSettingKeyVO;
import com.jwsoft.manager.common.vo.eduClassSetting.EduClassSettingQueryVO;
import com.github.pagehelper.PageInfo;
import com.bifang.engine.assistant.core.domain.AppResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import com.bifang.engine.protect.core.annotation.Idempotent;
import org.springframework.validation.annotation.Validated;
import com.bifang.assistant.common.constants.Validators;

/**
 * 分班设置管理网关
 *
 * @author chenzh
 * @since 2023-08-21
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "分班设置管理", description = "分班设置管理")
public class EduClassSettingController {

    @Autowired
    public EduClassSettingIntegration eduClassSettingIntegration;

    @Operation(summary = "分班设置管理分页查询", description = "分班设置管理分页查询")
    @PostMapping(value = "/eduClassSetting0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduClassSettingVO>> getList(@RequestBody @Validated EduClassSettingQueryVO vo) {
        return AppResponse.successData(eduClassSettingIntegration.getList(vo));
    }

    @Operation(summary = "分班设置管理根据主键查询详情", description = "分班设置管理根据主键查询详情")
    @PostMapping(value = "/eduClassSetting0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduClassSettingVO> getById(@RequestBody @Validated EduClassSettingKeyVO vo) {
        return AppResponse.successData(eduClassSettingIntegration.getById(vo));
    }

    @Idempotent(expire = "PT2S") //2秒内防重复提交
    @Operation(summary = "分班设置管理新增", description = "分班设置管理新增")
    @PostMapping(value = "/eduClassSetting0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduClassSettingVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduClassSettingVO vo) {
        return AppResponse.successData(eduClassSettingIntegration.add(vo));
    }

    @Idempotent(expire = "PT2S") //2秒内防重复提交
    @Operation(summary = "分班设置管理修改", description = "分班设置管理修改")
    @PostMapping(value = "/eduClassSetting0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduClassSettingVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduClassSettingVO vo) {
        return AppResponse.successData(eduClassSettingIntegration.edit(vo));
    }

    @Idempotent(expire = "PT2S") //2秒内防重复提交
    @Operation(summary = "分班设置管理删除", description = "分班设置管理删除")
    @PostMapping(value = "/eduClassSetting0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduClassSettingKeyVO vo) {
        eduClassSettingIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }

    @Operation(summary = "分班设置根据年份和学校id查询信息", description = "分班设置根据年份和学校id查询信息")
    @PostMapping(value = "/eduClassSetting0007", produces = "application/json;charset=UTF-8")
    public AppResponse<EduClassSettingVO> getByYearAndSchoolId(@RequestBody EduClassSettingYearQueryVO vo) {
        return AppResponse.successData(eduClassSettingIntegration.getByYearAndSchoolId(vo));
    }
}
